package com.csxh.user.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;

import com.csxh.user.r.R;

/**
 * Application Lifecycle Listener implementation class InitKeysListener
 *
 */
@WebListener
public class InitRListener implements ServletRequestListener, ServletContextListener {

    /**
     * Default constructor. 
     */
    public InitRListener() {
        // TODO Auto-generated constructor stub
    }

	/**
     * @see ServletRequestListener#requestDestroyed(ServletRequestEvent)
     */
    public void requestDestroyed(ServletRequestEvent sre)  { 
         // TODO Auto-generated method stub
    }

	/**
     * @see ServletRequestListener#requestInitialized(ServletRequestEvent)
     */
    public void requestInitialized(ServletRequestEvent sre)  { 
         // TODO Auto-generated method stub
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent sce)  { 
         // TODO Auto-generated method stub
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent sce)  { 
         
    	R.loginedKey="loginedKey";
    	R.userKey="userKey";
    	R.loginedValue=sce.getServletContext().getInitParameter(R.loginedKey);
    	if(null==R.loginedValue){
    		R.loginedValue="true";
    	}
    	R.userValue=sce.getServletContext().getInitParameter(R.userKey);
    	if(null==R.userValue){
    		R.userValue="user";
    	}
    	
    }
	
}
